package com.woniuxy.educationplatform.service.impl;

import com.woniuxy.educationplatform.bean.TeacherBean;
import com.woniuxy.educationplatform.mapper.TeacherMapper;
import com.woniuxy.educationplatform.service.ITeacherService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional(readOnly = true)
@Service
public class TeacherServiceImpl implements ITeacherService {
    @Resource
    private TeacherMapper teacherMapper;
    @Override
    public List<TeacherBean> findAll() {
        return teacherMapper.findAll();
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public int update(TeacherBean teacherBean) {
        return teacherMapper.update(teacherBean);
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public int del(Long id) {
        return teacherMapper.del(id);
    }

    @Override
    public List<TeacherBean> findByCondition(TeacherBean teacherBean) {
        return teacherMapper.findByCondition(teacherBean);
    }

    @Override
    public String[] getProject() {
        return teacherMapper.getProject();
    }

    @Override
    public String[] getTeacher() {
        return teacherMapper.getTeacher();
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public int add(TeacherBean teacherBean) {
        return teacherMapper.add(teacherBean);
    }

    @Override
    public TeacherBean findById(Long id) {
        return teacherMapper.findById(id);
    }
}
